EMG (experimental)

Teslasuit v. Teslasuit SDK Python

Quick access

What is EMG?

Electromyography (EMG) is a technique for evaluating and recording the electrical activity produced by skeletal muscles. EMG sensors detect electrical signals generated by muscle fibers during contraction and relaxation. This data is widely used in medical diagnostics, rehabilitation, biomechanics, and human-computer interaction to assess muscle function, fatigue, and neuromuscular health.

EMG is a key technology in wearable devices, enabling real-time monitoring of muscle activity. Its applications range from gesture recognition and prosthetics control to sports science and rehabilitation.

EMG in Teslasuit

The Teslasuit integrates EMG technology as part of its biometry subsystem, enabling advanced muscle activity monitoring. The EMG subsystem in the Teslasuit is designed to provide real-time data on muscle activation, raw EMG signals, and configurable filtering options. This data can be used for various applications, including gesture recognition, fatigue monitoring, and biofeedback.

The Teslasuit’s EMG functionality is accessible through the TsEmg class, which provides methods for streaming raw data, setting filter options, and retrieving processed EMG data. The EMG subsystem is tightly integrated with the Teslasuit API, allowing developers to seamlessly incorporate EMG data into their applications.

Key Features of the Teslasuit EMG Subsystem

  1. Raw Data Streaming: The Teslasuit EMG subsystem allows developers to stream raw EMG data in real time for custom signal processing and analysis.
  2. Configurable Filtering: The subsystem provides options to set filter parameters such as bandwidth, sampling frequency, and sample size for optimal signal quality.
  3. Multi-Node and Multi-Channel Support: The EMG subsystem supports multiple sensor nodes and channels, enabling comprehensive muscle activity monitoring across different body areas.
  4. Timestamps and Synchronization: Each EMG data sample is timestamped, allowing for precise synchronization with other sensor data.

How the Teslasuit API Implements EMG

The Teslasuit API provides a structured approach to accessing and utilizing EMG data. Below are the key steps involved:

  1. Initialization: The Teslasuit API must be initialized before accessing the EMG subsystem. This ensures that the API is ready to communicate with the Teslasuit device.
  2. Device Connection: A Teslasuit device must be connected to access its EMG subsystem. The API provides methods to wait for and retrieve connected devices.
  3. Subsystem Access: The EMG subsystem is accessed through the emg property of the connected device. This property returns an instance of the TsEmg class.
  4. Data Streaming and Retrieval: The TsEmg class provides methods to start/stop streaming and retrieve EMG data with the desired configuration.

Description of EMG Data

Below is a detailed description of the EMG data and data structures used in the Teslasuit API for the EMG subsystem.

EMG Options

What are EMG Options?

EMG options define the filtering and sampling parameters for EMG data acquisition. The main options include:

  • Lower Bandwidth: The lower cutoff frequency for the EMG signal filter.
  • Upper Bandwidth: The upper cutoff frequency for the EMG signal filter.
  • Sampling Frequency: The rate at which EMG samples are collected.
  • Sample Size: The number of samples per data packet.

Why EMG Options Matter

By configuring these options, developers can optimize EMG signal quality for different applications, reduce noise, and tailor data acquisition to specific muscle activity patterns.

EMG Options in Teslasuit

Teslasuit exposes EMG options through the TsEmgOptions structure. These options can be set using the set_options() method of the TsEmg class.

EMG Data Structures

  • TsEmgChannelData: Represents EMG data for a single channel, including channel index, number of samples, and the sample values.
  • TsEmgNodeData: Represents EMG data for a single node, including node index, channels, and timestamps.
  • TsEmgData: Represents the complete EMG data set, including all nodes, channels, and options.

Applications of EMG in Teslasuit

The EMG subsystem in the Teslasuit has a wide range of applications, including:

  • Gesture Recognition: Detect and classify hand or body gestures based on muscle activity patterns.
  • Rehabilitation: Monitor muscle activation and fatigue during therapy and recovery exercises.
  • Sports Science: Analyze muscle performance, coordination, and fatigue in athletes.
  • Human-Computer Interaction: Enable intuitive control of devices and virtual environments using muscle signals.

Dependencies in Data Structures and Accessing Data

The Teslasuit EMG subsystem relies on a hierarchy of data structures to manage and process EMG data. Below is a detailed description of the dependencies between these structures and a block scheme illustrating how data is accessed.

Data Structure Dependencies

  1. TsEmgOptions:
    • Represents EMG filter and sampling options.
  2. TsEmgChannelData:
    • Represents EMG data for a single channel (samples, channel index).
  3. TsEmgNodeData:
    • Represents EMG data for a single node (channels, timestamps).
  4. TsEmgData:
    • Represents the complete EMG data set (nodes, options).

Block Scheme for Accessing Data

Below is a simplified block scheme illustrating the flow of data from options and nodes to channel samples:

flowchart TD
    A([TsEmgData]) --> B[[TsEmgNodeData]]
    B --> C[[TsEmgChannelData]]
    C --> D((samples))
    A --> E[[TsEmgOptions]]
    E --> F((lower_bandwidth))
    E --> G((upper_bandwidth))
    E --> H((sampling_frequency))
    E --> I((sample_size))

Example Code

For detailed examples of how to use the EMG subsystem in the Teslasuit API, refer to the EMG Examples page. These examples demonstrate how to initialize the API, connect to a device, and retrieve EMG data.

Conclusion

The EMG subsystem in the Teslasuit represents a powerful tool for real-time muscle activity monitoring. By leveraging the Teslasuit API, developers can integrate EMG data into a wide range of applications, from gesture recognition to rehabilitation and sports science.